package com.zr.serviceimpl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import net.sf.json.JSONArray;

import com.zr.dao.EmployeedaoSCM;
import com.zr.dao.Functiondao;
import com.zr.service.EmployeeServiceSCM;

/**
 * @author  shichongming
 * @E-mail: 
 * @date 创建时间：2017年7月5日 下午3:31:55 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */
@Service("employeeService")
public class EmployeeServiceimplSCM implements EmployeeServiceSCM{

	
	
	//属性注入
	@Resource
	private  EmployeedaoSCM employeedao;
		
	/**
	 * 求出员工的总数包括公司员工，配送点管理员，车辆管理员
	 * */
	@Override
	public int findEmployeetTotal() {
		
		return employeedao.findEmployeetTotal();
	}

	/**
	 * 对公司的全部员工进行分页
	 * */
	@Override
	public JSONArray findEmployeePage(int page,int rows) {
	
		return employeedao.findEmployeePage(page, rows);
	}

	
	/**
	 * 
	 * 展示入职时选择的角色
	 * 
	 * */
	@Override
	public JSONArray findAllRole() {
	
		return employeedao.findAllRole();
	}
	/**
	 * 展示入职时候选择的配送点名称
	 * */

	@Override
	public JSONArray findAllDeliverypoint() {
		
		return employeedao.findAllDeliverypoint();
	}
	
	
	/**
	 * 增加员工
	 * */
	@Override
	public int addEmployee(String eiName, String eipostion, String eiPhone,
			String uname, String upsw
			) {
		
		return employeedao.addEmployee(eiName, eipostion, eiPhone, uname, upsw);
	}

	/**
	 * 增加员工的角色
	 * */
	@Override
	public int addEmployeeRole(String uname, String upsw, int rid) {	
		return employeedao.addEmployeeRole(uname, upsw, rid);
	}

	

	/**
	 * 
	 * 查询出新员工的id号
	 * */
	@Override
	public int findNewEmployeeId(String uname, String upsw) {
		
		return employeedao.findNewEmployeeId(uname, upsw);
	}

	/**
	 * 根据新员工的id号增加新员工的配送点名称
	 * 
	 * */
	@Override
	public int addEmployeeDeliverypoint(int dpid, int eiId) {	
		return employeedao.addEmployeeDeliverypoint(dpid, eiId);
	}

	
	
	
	
	/**
	 * 
	 * 员工离职
	 */
	@Override
	public void deleteEmployee(int eiId) {	
		employeedao.deleteEmployee(eiId);
	}
	
	
	
	
	/**
	 * 
	 * 删除员工
	 */
	@Override
	public void deleteEmployees(int eiId) {	
		employeedao.employeeRemove(eiId);
		
	}

	
	
	/**
	 * 修改员工的信息
	 * 
	 * */
	/*@Override
	public void updateEmployees(int eild, String eipostion, String eiPhone,
			String upsw, String eistate, String ustate,int dpid,int rid) {
		
		employeedao.updateEmployeeinfo(eild, eipostion, eiPhone, upsw, eistate, ustate);
		System.out.println(6666666);////////
		employeedao.updateEmployeedpid(dpid, eild);
		int uid=employeedao.findEmployeeUid(eild);
		employeedao.updateEmployeeRid(uid, rid);	
		
	}*/
	@Override
	public void updateEmployeeinfo(int eild, String eipostion, String eiPhone,
			String upsw, String eistate, String ustate) {
		employeedao.updateEmployeeinfo(eild, eipostion, eiPhone, upsw, eistate, ustate);
			
	}

	@Override
	public void updateEmployeedpid(int dpid, int eild) {
		employeedao.updateEmployeedpid(dpid, eild);
		
	}

	@Override
	public int findEmployeeUid(int eild) {
		employeedao.findEmployeeUid(eild);
		return 0;
	}

	@Override
	public void updateEmployeeRid(int uid, int rid) {
		employeedao.updateEmployeeRid(uid, rid);
		
	}

	
	
	
	
	
	
	
	
	
	

	/**
	 * 求出司机总数
	 * */

	@Override
	public int getDrivertotal() {
		
		return employeedao.getDrivertotal();
	}	
	/**
	 * 展示司机并分页
	 * 
	 * */
	@Override
	public JSONArray findDriver(int page, int rows) {
		
		return employeedao.findDriver(page, rows);
	}

	
	
	

	/**
	 * 
	 * 司机入职
	 * */
	@Override
	public int addDriver(String driverName, String driverPhone, String uname,
			String upsw) {
		return employeedao.addDriver(driverName, driverPhone, uname, upsw);
	}
	
	
	/**
	 * 增加司机的角色
	 * */	
	@Override
	public int addDriverRole(String uname, String upsw, int rid) {
		
		return employeedao.addDriverRole(uname, upsw, rid);
	}
	
	/**
	 * 
	 * 司机离职，修改状态
	 * */
		@Override
	public int deleteDriver(int driverId) {
		
		return employeedao.deleteDriver(driverId);
	}

		/**
		 * 修改司机角色
		 * */
		
	@Override
	public int updateDriver(int driverId, String driverPhone, String upsw,
			String ustate) {
		// TODO Auto-generated method stub
		return employeedao.updateDriver(driverId, driverPhone, upsw, ustate);
	}
	/**
	 * 修改司机的角色
	 * */
	@Override
	public int updateDriverRole(int uid, int rid) {
		
		return employeedao.updateDriverRole(uid, rid);
	}


	
	
}
